﻿using ApplicationModels.A02.Identities;
using ApplicationModels.A03.Photographs;
using ApplicationModels.A04.Interactions;
using ApplicationModels.A05.Reports;
using ApplicationModels.A06.Socializes;
using ApplicationModels.A07.Chats;
using ApplicationService;
using Emails;
using EntityModels.E02.Identities;
using EntityModels.E03.Photographs;
using EntityModels.E04.Interactions;
using EntityModels.E05.Reports;
using EntityModels.E06.Socializes;
using EntityModels.E07.Chats;
using IApplicationServices;
using IRepositories;
using JWT;
using Repositories;
using System.Reflection;

namespace WebAPI.Helpers
{
    public static class InjectionHelp
    {
        public static void Injection(this IServiceCollection services)
        {
            #region Commons
            
            services.AddScoped<IEmailClient, QQEmailClient>();
            #endregion

            #region 身份认证
            services.AddScoped<ITokenService, TokenService>();
            services.AddScoped<IAuthenticationRepository, AuthenticationRepository>();
            services.AddScoped<IWeChatRepository, WeChatRepository>();
            services.AddScoped<AuthenticationService>();
            #endregion
            #region 文件
            services.AddScoped<IFileHashRepository, FileHashRepository>();
            services.AddScoped<IFilePathRepository, FilePathRepository>();
            services.AddScoped<IFileHashService, FileHashService>();
            services.AddScoped<IFilePathService, FIlePathService>();
            #endregion



            #region 作品类型
            services.AddScoped<IBaseRepository<int, PhotographType>, BaseRepository<int, PhotographType>>();
            services.AddScoped<IPhotographTypeRepository, PhotographTypeRepository>();
            services.AddScoped<IBaseApplicationService<int, PhotographType, PhotographTypeAM>, BaseApplicationService<int, PhotographType, PhotographTypeAM>>();
            services.AddScoped<IPhotographTypeService, PhotographTypeService>();
            #endregion
            #region 作品
            services.AddScoped<IBaseRepository<Guid, Photograph>, BaseRepository<Guid, Photograph>>();
            services.AddScoped<IPhotographRepository, PhotographRepository>();
            services.AddScoped<IBaseApplicationService<Guid, Photograph, PhotographAM>, BaseApplicationService<Guid, Photograph, PhotographAM>>();
            services.AddScoped<IPhotographService, PhotographService>();
            #endregion
            #region 作品评论
            services.AddScoped<IBaseRepository<int, Comment>, BaseRepository<int, Comment>>();
            services.AddScoped<ICommentRepository, CommentRepository>();
            services.AddScoped<IBaseApplicationService<int, Comment, CommentAM>, BaseApplicationService<int, Comment, CommentAM>>();
            services.AddScoped<ICommentService, CommentService>();
            #endregion

            #region 举报类型
            services.AddScoped<IBaseRepository<int, ReportType>, BaseRepository<int, ReportType>>();
            services.AddScoped<IBaseApplicationService<int, ReportType, ReportTypeAM>, BaseApplicationService<int, ReportType, ReportTypeAM>>();
            services.AddScoped<IReportTypeService, ReportTypeService>();
            #endregion

            #region 举报评论
            services.AddScoped<IBaseRepository<int, CommentReport>, BaseRepository<int, CommentReport>>();
            services.AddScoped<IBaseApplicationService<int, CommentReport, CommentReportAM>, BaseApplicationService<int, CommentReport, CommentReportAM>>();
            services.AddScoped<ICommentReportService, CommentReportService>();
            #endregion
            #region 举报作品
            services.AddScoped<IBaseRepository<int, Report>, BaseRepository<int, Report>>();
            services.AddScoped<IBaseApplicationService<int, Report, ReportAM>, BaseApplicationService<int, Report, ReportAM>>();
            services.AddScoped<IPhotographReportService, PhotographReportService>();
            services.AddScoped<IPhotographReportRepository, PhotographReportRepository>();
            #endregion
            #region 社交
            services.AddScoped<IBaseRepository<int, Follow>, BaseRepository<int, Follow>>();
            services.AddScoped<IBaseApplicationService<int, Follow, FollowAM>, BaseApplicationService<int, Follow, FollowAM>>();
            services.AddScoped<IFollowService, FollowService>();
            #endregion
            #region 收藏
            services.AddScoped<IBaseRepository<int, Star>, StarRepository>();
            services.AddScoped<IBaseApplicationService<int, Star, StarAM>, BaseApplicationService<int, Star, StarAM>>();
            services.AddScoped<IBaseRepository<int, StarItem>, BaseRepository<int, StarItem>>();
            services.AddScoped<IBaseApplicationService<int, StarItem, StarItemAM>, BaseApplicationService<int, StarItem, StarItemAM>>();
            #endregion
            #region 用户
            services.AddScoped<IBaseRepository<Guid, AppUser>, BaseRepository<Guid,AppUser>>();
            services.AddScoped<IBaseApplicationService<Guid, AppUser, AppUserAM>, BaseApplicationService<Guid, AppUser, AppUserAM>>();
            services.AddScoped<IUserRepository, UserRepository>();
            services.AddScoped<IUserService, UserService>();
            #endregion
            #region 点赞
            services.AddScoped<IBaseRepository<int, Like>, BaseRepository<int, Like>>();
            services.AddScoped<ILikeRepository, LikeRepository>();
            services.AddScoped<IBaseApplicationService<int, Like, LikeAM>, BaseApplicationService<int, Like, LikeAM>>();
            services.AddScoped<ILikeService, LikeService>();
            #endregion
            #region 消息
            services.AddScoped<IMessageService, MessageService>();
            services.AddScoped<IBaseRepository<int, Message>, BaseRepository<int, Message>>();
            services.AddScoped<IBaseApplicationService<int, Message, MessageAM>, BaseApplicationService<int, Message, MessageAM>>();
            services.AddScoped<IConversationService, ConversationService>();
            services.AddScoped<IBaseRepository<int, Conversation>, BaseRepository<int, Conversation>>();
            services.AddScoped<IBaseApplicationService<int, Conversation, ConversationAM>, BaseApplicationService<int, Conversation, ConversationAM>>();
            services.AddScoped<IConversationRepository, ConversationRepository>();
            #endregion
            #region 队列
            services.AddScoped<IRabbitMQService, RabbitMQService>();
            #endregion
        }
    }
}
